package initialize

import (
	"gin-simple/global"
	"github.com/go-playground/validator/v10"
	zhTranslations "github.com/go-playground/validator/v10/translations/zh"
)

func InitValidate() (validate *validator.Validate) {
	validate = validator.New()
	validate.SetTagName("binding")

	// 注册翻译器
	_ = zhTranslations.RegisterDefaultTranslations(validate, global.Trans)

	return
}
